<?php
                class bisnis_model extends CI_Model {
                    function __construct(){
                        parent::__construct();
                        $this->tableName = "bisnis";
                    }
                    function insert($bisnisalumniid, $bisnisnama, $bisnisalamat, $bisniskota, $bisnispropinsi, $bisniscontact, $bisnisemail, $bisniscategoryid, $bisnisstatus, $bisnisdescr, $createdby, $updatedby){
                        $dt = array("bisnisalumniid" => $bisnisalumniid, 
                        "bisnisnama" => $bisnisnama, 
                        "bisnisalamat" => $bisnisalamat, 
                        "bisniskota" => $bisniskota, 
                        "bisnispropinsi" => $bisnispropinsi, 
                        "bisniscontact" => $bisniscontact, 
                        "bisnisemail" => $bisnisemail, 
                        "bisniscategoryid" => $bisniscategoryid, 
                        "bisnisstatus" => $bisnisstatus, 
                        "bisnisdescr" => $bisnisdescr, 
                        "created" => date("Y-m-d H:i:s"), 
                        "createdby" => $createdby, 
                        "updatedby" => $updatedby);
                        $this->db->insert($this->tableName, $dt);
                        return $this->db->insert_id();
                    }
                    
                    function update($bisnisid, $dt, $where=""){
                        $this->db->where("bisnisid", $bisnisid);
                        if($where != "")$this->db->where($where);
                        $this->db->update($this->tableName, $dt);
                    }
                    
                    function delete($bisnisid,  $where = ""){
                        $this->db->where("bisnisid", $bisnisid);
                        if($where != "")$this->db->where($where);
                        $this->db->delete($this->tableName);
                    }
                    
                    function getById($bisnisid,  $where=""){
                        $this->db->where("bisnisid", $bisnisid);
                        if($where != "")$this->db->where($where);
                        return $this->db->get($this->tableName)->row();
                    }
                    
                    function getAll($startpage="0", $perpage="10", $where = "", $orderby=""){
                        if($where != "")$this->db->where($where);
                        $this->db->limit($perpage, $startpage);
                        if($orderby != "")$this->db->order_by($orderby);
                        return $this->db->get($this->tableName)->result();
                    }
                    
                    function getAllCount($where = ""){
                        $this->db->select("COUNT(*) JUMLAH");
                        $this->db->from($this->tableName);
                        if($where != "")$this->db->where($where);
                        return $this->db->get()->row()->JUMLAH;
                    }
                }
                ?>